package com.gopi.utilities.gui;

import javax.swing.tree.DefaultMutableTreeNode;

abstract public class NewAbstractTreeNode extends DefaultMutableTreeNode 
{
	
	//-- node type for popup menu - 0 for no menus
	public static final int NO_MENU = 0;
	// --
	
	public static final int ROOT_NODE = 0;
	public static final int LEAF_NODE = 1;
	public static final int EXPANDED_NODE = 2;
	public static final int CLOSED_NODE = 3;
	public static final int LOADING_NODE = 4;
	
	// icons names will be based on keys. take care before editing key !
	// look at ImageLoader.java
	public static final String ROOT_NODE_KEY = "root";
	public static final String LEAF_NODE_KEY = "leaf";
	public static final String EXPANDED_NODE_KEY = "expand";
	public static final String CLOSED_NODE_KEY = "closed";
	public static final String LOADING_NODE_KEY = "loading";
	
	abstract public String getIconKey(int status);
	public String getIconKey()
	{
		return getIconKey(getNodeType());
	}
	abstract public int getNodeType();
	
	public String getDefaultIconKey(int status)
	{
		return (new String[] {ROOT_NODE_KEY,LEAF_NODE_KEY,
				EXPANDED_NODE_KEY,CLOSED_NODE_KEY,
				LOADING_NODE_KEY})[status];
	}
	
	public int getNodeTypeForMenu()
	{
		return NO_MENU;
	}
}
